<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<title>20.1. Basic Search and Replace</title>
		<link type="text/css" rel="stylesheet" href="PLUGINS_ROOT/org.polarsys.capella.doc/html/styles.css"/>
	</head>
	<body>
		<h1 id="Basic_Search_.26_Replace">Basic Search &amp; Replace</h1>
		<h2 id="Overview">Overview</h2>
		<p>Capella provides Search &amp; Replace functionalities on model elements that follow the Eclipse Search &amp; Replace convention. Several options are provided to enable fine grained Search &amp; Replace on Capella models.</p>
		<p>To open the Search &amp; Replace window dialog, go to the 
			<b>Search</b> toolbar (Ctrl + H).
		</p>
		<p>
			<img border="0" src="Images/20.1Search_and_Replace_Open.png"/>
		</p>
		<p>
			<b>Fig.</b> Search &amp; Replace toolbar menu.
		</p>
		<h2 id="Search_Options">Search Options</h2>
		<h3 id="Model_Element_Scope">Model Element Scope</h3>
		<p>Model element scope can be customized in the 
			<b>Search For</b> section which allows us to specify the granularity  of content to search for:
		</p>
		<ul>
			<li>Search in specific features of selected meta-classes</li>
			<li>Search in diagram (attributes of diagrams or notes)</li>
			<li>Filter criteria: the user can choose to filter abstract or non semantic elements</li>
		</ul>
		<p>On the left side of the 
			<b>Search For</b> section, the meta-classes can be selected, the right panel will be updated with the union of the attributes of the selected meta-classes.
			We have the option to apply the default search for granularity by pressing the 
			<b>Restore Defaults</b> buttons.
		</p>
		<p>
			<img border="0" src="Images/20.1Search_and_Replace_Search_For.png"/>
		</p>
		<p>
			<b>Fig.</b> Model element search for scope options.
		</p>
		<h3 id="Find_Pattern">Find Pattern</h3>
		<p>The user can type a text which will be used to match model elements according to the search for selection when performing the search. As in Eclipse, the user has several options which can be selected when searching:</p>
		<ul>
			<li>
				<b>Case sensitive</b>.
			</li>
			<li>
				<b>Regular expression</b>: enables the use of * and ? in the find expression 	i.e. * matches zero or more characters and ? matches zero or one 	character.
			</li>
			<li>
				<b>Whole word</b>: only model elements that starts by the find 	expressions (e.g. &ldquo;ABC DEF&rdquo; matches &ldquo;ABC DEF GHI&rdquo; 	but not &ldquo;ABC DEFG&rdquo;)
			</li>
		</ul>
		<p>
			<img border="0" src="Images/20.1Search_and_Replace_Text_Options.png"/>
		</p>
		<p>
			<b>Fig.</b> Find pattern options.
		</p>
		<p>
			<b>Note:</b> selecting &ldquo;
			<i>Wildcards&rdquo;</i> options disables &ldquo;
			<i>Whole expression</i>&rdquo; option.
		</p>
		<h3 id="Search_Scope">Search Scope</h3>
		<p>The Capella Search dialog provides a section to define the search scope which only concerns opened sessions:</p>
		<ul>
			<li>The 
				<b>Workspace</b> scope applies on all projects in the workspace
			</li>
			<li>The 
				<b>Selected model elements</b> scope applies on selected elements
			</li>
			<li>The 
				<b>Enclosing project</b> scope applies on current project
			</li>
		</ul>
		<p>
			<img border="0" src="Images/20.1Search_and_Replace_Scope.png"/>
		</p>
		<p>
			<b>Fig.</b> Model scope options
		</p>
		<h3 id="Search_and_Replace_Operations">Search and Replace Operations</h3>
		<p>From the Capella Search dialog we have the option to fill a text pattern and then perform:</p>
		<ul>
			<li>
				<b>Search</b>: pressing the search button will close the current dialog and will display the search results in a separate window.
			</li>
			<li>
				<b>Replace</b> will open a dialog box that will have the possibility to enter a replacement text pattern.
			</li>
		</ul>
		<h3 id="Search_Result">Search Result</h3>
		<p>When performing a search in Capella, the matching model elements according to the selected criteria in the search dialog will be found. The result will be displayed in separate view as below, following the Eclipse Search &amp; Result conventions.</p>
		<p>
			<img border="0" src="Images/20.1Search_and_Replace_Search_Result.png"/>
		</p>
		<p>
			<b>Fig.</b> Search result window
		</p>
		<p>By default, the Capella search result is displayed as a tree but the user can use the view menu from the right side to choose to display the result as tree or as a list.

			<img border="0" src="Images/20.1Search_and_Replace_Result_Display.png"/>
		</p>
		<p>
			<b>Fig. </b>Search result tree or list mode
		</p>
		<h3 id="Search_Result_Operations">Search Result Operations</h3>
		<p>In the Capella search result view we will be able to perform operations on the results (text replacement, navigation to the element in Project Explorer, next match, previous match etc).</p>
		<p>
			<img border="0" src="Images/20.1Search_and_Replace_ResultOperations.png"/> 
		</p>
		<p>
			<b>Fig. </b>Search result operations
		</p>
		<p>
			<br/>

			<br/>
		</p>
		<h2 id="Replace_Text_Pattern">Replace Text Pattern</h2>
		<p>We can replace a text pattern from the Capella search result view or from the Capella search dialog. 
			The user has the possibility to replace a text pattern, a single occurrence or replace all the occurrences.</p>
		<p>
			<img border="0" src="Images/20.1Search_and_Replace_Replace_Occurrence.png"/>
		</p>
		<p>
			<b>Fig.</b> Model replace text pattern
		</p>
	</body>
</html>